﻿
using System;
using System.Collections.Generic;
using MiniWeb.Core.Dtos;
using MiniWeb.Core.Entities;
using MiniWeb.Dao;
using MiniWeb.Core.Entities;
using WFramework.MvcPager;

namespace MiniWeb.Task
{
    public class ProductsInfoTask
    {
        private readonly ProductsInfoDao _dao = new ProductsInfoDao();
        public PagedList<ProductsInfoDto> GetPagedList(int? rid, int? cid, int? pid, bool isSell, bool isChuXiao, bool isHot, bool isWeb, DateTime? starttime, DateTime? endtime,int? pl, int pageIndex, int pageSize)
        {
            return _dao.GetPagedList(rid, cid, pid, isSell, isChuXiao, isHot, isWeb, starttime, endtime,pl, pageIndex, pageSize);
        }

        public ProductsInfo GetById(int id)
        {
            return _dao.GetById(id);
        }

        public ProductsInfo GetByPosition(int pid)
        {
            return _dao.GetByPosition(pid);
        }


        public List<ChuChuangProductsDto> GetChuChuangList()
        {
            return _dao.GetChuChuangList();
        }

        public void Delete(int id)
        {

            _dao.Delete(id);
        }


        public bool Exists(int id)
        {

            return _dao.Exists(id);
        }

        public void Add(ProductsInfo model)
        {

            _dao.Add(model);
        }

        public void Update(ProductsInfo model)
        {

            _dao.Update(model);
        }

        public List<ProductsInfoDto> GetAll(int? top, string strwhere, string orderby)
        {
            return _dao.GetAll(top, strwhere, orderby);
        }



    }
}